package work20240808.work7;

public class letter extends Thread{
    private int lenth = 26;

    @Override
    public void run() {
        synchronized(lock.o){
            char c = (char)('A' - 1);
            for(int i = 1;i <= 26;i++){
                while(!lock.flag) {
                    try {
                        lock.o.wait();
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
                c = (char)(c + 1);
                System.out.print(c + " ");
                lock.flag = false;
                lock.o.notifyAll();
            }
        }
    }
}
